package cn.zucc.edu.handyzucc.controller;

import cn.zucc.edu.handyzucc.entity.Dorm;
import cn.zucc.edu.handyzucc.service.DormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/dorm")
public class DormController {
    @Autowired
    private DormService dormService;

    @RequestMapping(value = "getDormById", method = RequestMethod.POST)
    private Map<String, Object> getDormsById(Integer user_dorm){
        Map<String, Object> modelMap = new HashMap<>();
        Dorm dorm = dormService.getDormById(user_dorm);
        modelMap.put("code", "0");
        modelMap.put("info", "查询成功");
        modelMap.put("data", dorm);
        return modelMap;
    }
}
